package com.example.basic01;

import java.io.File;
import java.util.List;
import java.util.Objects;
import java.util.UUID;

public class DoubleDemo {

    static class Stu {
        private Integer id;
        private String name;
        private Double score;

        public Stu(Integer id, String name, Double score) {
            this.id = id;
            this.name = name;
            this.score = score;
        }

        public Integer getId() {
            return id;
        }

        public void setId(Integer id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public Double getScore() {
            return score;
        }

        public void setScore(Double score) {
            this.score = score;
        }

        @Override
        public String toString() {
            return "Stu{" +
                    "id=" + id +
                    ", name='" + name + '\'' +
                    ", score=" + score +
                    '}';
        }
    }

    public static void main(String[] args) throws Exception {
//        List<Stu> old = new ArrayList<>();
//        old.add(new Stu(1, "张三", 0.1d));
//        old.add(new Stu(2, "李四", 0.2d));
//        List<Stu> newStu = handle(old);
//        System.out.println(newStu);
//        System.out.println(old);
//        int i = 1;
//        while (i < 4) {
//            i++;
//            System.out.printf("\ni=%d", i);
//        }
//        String prepare = prepare();xi
//        System.out.println(prepare);
//        File file = new File(prepare);
//        file.delete();
        System.out.println(Objects.equals(null, new Integer(1)));

    }

    public static List<Stu> handle(List<Stu> old) {
        old.forEach(o -> {
            if (o.getId() == 1) {
                o.score = 0.5d;
            }
        });
        return old;
    }

    private static String prepare() throws Exception {
        File file = new File(System.getProperty("java.io.tmpdir"), "contract-download-" + UUID.randomUUID().toString() + ".zip");
        if (!file.exists()) {
            file.createNewFile();
        }
        final String path = file.getAbsolutePath();
        return path;
    }


}
